<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>REM Module &mdash; RiverREM 1.0.4 documentation</title>
      <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script src="_static/doctools.js"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="DEM Visualization Module" href="vizindex.html" />
    <link rel="prev" title="Welcome to RiverREM’s documentation!" href="index.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
            <a href="index.html" class="icon icon-home"> RiverREM
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">REM Module</a></li>
<li class="toctree-l1"><a class="reference internal" href="vizindex.html">DEM Visualization Module</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">RiverREM</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
      <li>REM Module</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/remindex.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="rem-module">
<h1>REM Module<a class="headerlink" href="#rem-module" title="Permalink to this heading"></a></h1>
<p>This module can be used to automatically produce visualizations of river relative elevation
models (REMs) from an input DEM.</p>
<p>River centerlines used to create REMs are automatically retrieved from the OpenStreetMap (OSM) API. If a desired river segment is not listed on OSM, a new river centerline can be created/edited at <a class="reference external" href="https://www.openstreetmap.org/edit">https://www.openstreetmap.org/edit</a> (clear the OSM cache folder after using the OSM editor to get the updated centerline). Alternatively, if OSM is up to date but the input DEM has older river topography, a user-provided centerline shapefile can be input, overriding the OSM centerline.</p>
<p>Points sampled along the river centerline(s) are output as a shapefile along with each output REM raster. These points can be viewed to help ensure that the applied centerline is accurate.</p>
<p>For very large/high resolution DEMs, interpolation can take a long time. While this module is designed to work well using the default settings on a variety of datasets, interpolation can be sped up by changing the following parameters from default values:</p>
<ul class="simple">
<li><p>decreasing interp_pts</p></li>
<li><p>increasing k</p></li>
<li><p>increasing eps</p></li>
<li><p>increasing workers (if more CPU threads are available)</p></li>
</ul>
<span class="target" id="module-riverrem.REMMaker"></span><dl class="py function">
<dt class="sig sig-object py" id="riverrem.REMMaker.clear_osm_cache">
<span class="sig-prename descclassname"><span class="pre">riverrem.REMMaker.</span></span><span class="sig-name descname"><span class="pre">clear_osm_cache</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#riverrem.REMMaker.clear_osm_cache" title="Permalink to this definition"></a></dt>
<dd><p>Clear the OSM cache folder (./.osm_cache). This is useful if the OSM Editor has been used to update
river centerlines.</p>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="riverrem.REMMaker.REMMaker">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">riverrem.REMMaker.</span></span><span class="sig-name descname"><span class="pre">REMMaker</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dem</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">centerline_shp</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">out_dir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'./'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">interp_pts</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">1000</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">k</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">eps</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0.1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">workers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cache_dir</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'./.cache'</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#riverrem.REMMaker.REMMaker" title="Permalink to this definition"></a></dt>
<dd><p>Handler to automatically make a river REM from an input DEM.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>dem</strong> (<em>str</em>) – path to input DEM raster.</p></li>
<li><p><strong>centerline_shp</strong> (<em>str</em>) – (optional) river centerline shapefile to use. If given, overrides OpenStreetMap centerline.</p></li>
<li><p><strong>out_dir</strong> (<em>str</em>) – output file directory. Defaults to current working directory.</p></li>
<li><p><strong>interp_pts</strong> (<em>int</em>) – maximum number of points to use for interpolation of river centerline elevation. Actual number
of points is limited by number of DEM pixels along centerline, so less points may be used for
lower resolution DEMs.</p></li>
<li><p><strong>k</strong> (<em>int</em>) – number of nearest neighbors to use for IDW interpolation. If None, an appropriate value is estimated.
The estimation routine uses k between 5-100 points (0.5-10% of the river length) depending on the
sinuosity of the river of interest. Greater values of k are used for more sinuous rivers.</p></li>
<li><p><strong>eps</strong> (<em>float</em>) – fractional error tolerance for finding nearest neighbors in KD tree query. Higher values allow faster
interpolation at the expense of accuracy.</p></li>
<li><p><strong>workers</strong> (<em>int</em>) – number of CPU threads to use for interpolation. -1 uses all threads.</p></li>
<li><p><strong>cache_dir</strong> (<em>str</em>) – cache directory</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="riverrem.REMMaker.REMMaker.make_rem">
<span class="sig-name descname"><span class="pre">make_rem</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#riverrem.REMMaker.REMMaker.make_rem" title="Permalink to this definition"></a></dt>
<dd><p>Make a relative elevation model (REM). Note that this method creates a raw REM raster and doesn’t apply
color-relief/shading for visualization.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>path to output REM raster.</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>str</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="riverrem.REMMaker.REMMaker.make_rem_viz">
<span class="sig-name descname"><span class="pre">make_rem_viz</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cmap</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'mako_r'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">z</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">blend_percent</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">25</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">make_png</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">make_kmz</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#riverrem.REMMaker.REMMaker.make_rem_viz" title="Permalink to this definition"></a></dt>
<dd><p>Create REM visualization by blending the REM color-relief with a DEM hillshade to make a pretty finished
product.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>cmap</strong> (<em>str</em>) – name of matplotlib/seaborn named colormap to use for REM coloring
(see <a class="reference external" href="https://matplotlib.org/stable/gallery/color/colormap_reference.html">https://matplotlib.org/stable/gallery/color/colormap_reference.html</a>). Note the applied
colormap is logarithmically scaled in order to emphasize elevations differences close to the river
centerline.</p></li>
<li><p><strong>z</strong> (<em>float &gt;1</em>) – z factor for exaggerating vertical scale differences of hillshade.</p></li>
<li><p><strong>blend_percent</strong> (<em>float</em><em> [</em><em>0-100</em><em>]</em>) – Percent weight of hillshdae in blended image, color-relief takes opposite weight.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>path to output raster</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="index.html" class="btn btn-neutral float-left" title="Welcome to RiverREM’s documentation!" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="vizindex.html" class="btn btn-neutral float-right" title="DEM Visualization Module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2022, Kenneth Larrieu.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>